/*
 * CMediaSourceFramer.h
 *
 *  Created on: 2019年1月9日
 *      Author: terry
 */

#ifndef CMEDIASOURCEFRAMER_H_
#define CMEDIASOURCEFRAMER_H_

#include "MediaSourceFramer.h"
#include "PacketQueue.h"


namespace av
{

class CMediaSourceFramer: public MediaSourceFramer
{
public:
	static const int64_t SEEK_STEP = 1000000 * 10;

public:
    CMediaSourceFramer();
    virtual ~CMediaSourceFramer();

	virtual bool open(MediaSourcePtr& source, int64_t pts);

	virtual void close();

	virtual int read(AVPacketPtr& pkt);

	virtual void setScale(float scale);

    virtual int64_t getTime();

protected:
	int readFrames(int64_t beginPts, int64_t endPts);

protected:
	MediaSourcePtr	m_mediaSource;
	int64_t	m_pts;
	float	m_scale;

	int64_t	m_beginPts;
	PacketQueue	m_pktQueue;

    int64_t m_curTime;

};


} /* namespace av */

#endif /* CMEDIASOURCEFRAMER_H_ */
